package thread;

class MyRunnnable implements Runnable{
    @Override
    public void run(){
        while(true) {
            System.out.println("hello thread");

            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
// 使用 Runnnable 的方式来创建线程
public class Demo2 {
    public static void main(String[] args) {
        MyRunnnable runnnable = new MyRunnnable();
        Thread t = new Thread(runnnable);
        t.start();
    }
}
